/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainMenu.java
 *
 * Created on Nov 9, 2011, 9:15:36 AM
 */
package javaapplication1;

import javax.swing.*;
import java.sql.*;

/**
 *
 * @author Kaizer Bruce Echo Eph
 */
public class MainMenu extends javax.swing.JFrame {
    private int YES_OPTION;
    private int YES_NO_OPTION;
        public static int ProductID1=0;
        public static String ProductName1="";
        public static String ProductType1="";
        public static float ProductPrice1;
        public static String ProductSupplier1="";
        public static String ProductLabel1="";
    /** Creates new form MainMenu */
    public MainMenu() {
       
        initComponents();
        if(Login.usertype.equals("Store Manager")){
       jTabbedPane2.setEnabledAt(1, false);
       jButton6.setEnabled(false);
       jButton7.setEnabled(false);
    }
        
        if(Login.usertype.equals("Store Clerk")){
        jTabbedPane2.setEnabledAt(0, false);
        jTabbedPane2.setEnabledAt(1, false);
        jButton6.setEnabled(false);
        jButton7.setEnabled(false);
        jButton8.setEnabled(false);
        jTabbedPane3.setEnabled(false);
        }
        
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        jTabbedPane1 = new javax.swing.JTabbedPane();
        starterPUEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("starterPU").createEntityManager();
        userManagementQuery = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT u FROM UserManagement u");
        userManagementList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : userManagementQuery.getResultList();
        inventoryProductsQuery = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT i FROM InventoryProducts i");
        inventoryProductsList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : inventoryProductsQuery.getResultList();
        inventoryProductsQuery1 = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT i FROM InventoryProducts i");
        inventoryProductsList1 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : inventoryProductsQuery1.getResultList();
        inventoryProductsQuery2 = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT i FROM InventoryProducts i");
        inventoryProductsList2 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : inventoryProductsQuery2.getResultList();
        inventoryProductsQuery3 = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT i FROM InventoryProducts i");
        inventoryProductsList3 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : inventoryProductsQuery3.getResultList();
        inventoryProductsQuery4 = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT i FROM InventoryProducts i");
        inventoryProductsList4 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : inventoryProductsQuery4.getResultList();
        inventoryProductsQuery5 = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT i FROM InventoryProducts i");
        inventoryProductsList5 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : inventoryProductsQuery5.getResultList();
        transactionProductsQuery = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT t FROM TransactionProducts t");
        transactionProductsList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : transactionProductsQuery.getResultList();
        transactionProductsQuery1 = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT t FROM TransactionProducts t");
        transactionProductsList1 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : transactionProductsQuery1.getResultList();
        transactionListQuery = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT t FROM TransactionList t");
        transactionListList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : transactionListQuery.getResultList();
        inventoryProductsQuery6 = java.beans.Beans.isDesignTime() ? null : starterPUEntityManager.createQuery("SELECT i FROM InventoryProducts i");
        inventoryProductsList6 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : inventoryProductsQuery6.getResultList();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel3 = new javax.swing.JPanel();
        jTabbedPane3 = new javax.swing.JTabbedPane();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        jButton7 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jButton5 = new javax.swing.JButton();
        jComboBox1 = new javax.swing.JComboBox();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTable4 = new javax.swing.JTable();
        jButton17 = new javax.swing.JButton();
        jSpinner4 = new javax.swing.JSpinner();
        jPanel5 = new javax.swing.JPanel();
        jButton14 = new javax.swing.JButton();
        jScrollPane9 = new javax.swing.JScrollPane();
        jTable9 = new javax.swing.JTable();
        jSpinner2 = new javax.swing.JSpinner();
        jPanel4 = new javax.swing.JPanel();
        jButton13 = new javax.swing.JButton();
        jButton15 = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        jTable8 = new javax.swing.JTable();
        jTabbedPane4 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jComboBox2 = new javax.swing.JComboBox();
        jButton9 = new javax.swing.JButton();
        jTextField2 = new javax.swing.JTextField();
        jScrollPane6 = new javax.swing.JScrollPane();
        jTable6 = new javax.swing.JTable();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTable7 = new javax.swing.JTable();
        jLabel3 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        jTextField3 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jButton10 = new javax.swing.JButton();
        jSpinner1 = new javax.swing.JSpinner();
        jSpinner3 = new javax.swing.JSpinner();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jButton2 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Main Menu");

        jTabbedPane2.setFont(new java.awt.Font("Tahoma", 1, 18));
        jTabbedPane2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane2MouseClicked(evt);
            }
        });

        jTabbedPane3.setFont(new java.awt.Font("Tahoma", 1, 14));
        jTabbedPane3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane3MouseClicked(evt);
            }
        });

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, inventoryProductsList4, jTable3);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productID}"));
        columnBinding.setColumnName("Product ID");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productName}"));
        columnBinding.setColumnName("Product Name");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productType}"));
        columnBinding.setColumnName("Product Type");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productLabel}"));
        columnBinding.setColumnName("Product Label");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productSupplier}"));
        columnBinding.setColumnName("Product Supplier");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productPrice}"));
        columnBinding.setColumnName("Product Price");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productQuantity}"));
        columnBinding.setColumnName("Product Quantity");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane3.setViewportView(jTable3);

        jButton7.setText("Remove Product");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jButton8.setText("Edit Product Information");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        jButton6.setText("Add Product");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)
                .addGap(61, 61, 61)
                .addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(42, 42, 42)
                .addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
                .addGap(47, 47, 47))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE)
                .addGap(40, 40, 40)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton8)
                    .addComponent(jButton6))
                .addGap(49, 49, 49))
        );

        jTabbedPane3.addTab("View Inventory List", jPanel6);

        jLabel1.setText("Search:");

        jTextField1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextField1MouseClicked(evt);
            }
        });
        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });

        jButton5.setText("Search");
        jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton5MouseClicked(evt);
            }
        });
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Name", "Type", "Supplier" }));
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });

        jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, inventoryProductsList3, jTable4);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productID}"));
        columnBinding.setColumnName("Product ID");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productName}"));
        columnBinding.setColumnName("Product Name");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productType}"));
        columnBinding.setColumnName("Product Type");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productLabel}"));
        columnBinding.setColumnName("Product Label");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productSupplier}"));
        columnBinding.setColumnName("Product Supplier");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productPrice}"));
        columnBinding.setColumnName("Product Price");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productQuantity}"));
        columnBinding.setColumnName("Product Quantity");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jTable4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable4MouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(jTable4);
        jTable4.getColumnModel().getColumn(6).setResizable(false);

        jButton17.setText("Update");
        jButton17.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton17MouseClicked(evt);
            }
        });
        jButton17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton17ActionPerformed(evt);
            }
        });

        jSpinner4.setFont(new java.awt.Font("Tahoma", 1, 18));

        jSpinner4.setModel(new javax.swing.SpinnerNumberModel(0, 0, 99999, 1));

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(56, 56, 56)
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton5))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap(446, Short.MAX_VALUE)
                .addComponent(jSpinner4, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButton17)
                .addGap(16, 16, 16))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButton17)
                    .addComponent(jSpinner4, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jTabbedPane3.addTab("Search Product", jPanel7);

        jButton14.setText("Update");
        jButton14.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton14MouseClicked(evt);
            }
        });
        jButton14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton14ActionPerformed(evt);
            }
        });

        jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, inventoryProductsList1, jTable9);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productID}"));
        columnBinding.setColumnName("Product ID");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productName}"));
        columnBinding.setColumnName("Product Name");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productPrice}"));
        columnBinding.setColumnName("Product Price");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productQuantity}"));
        columnBinding.setColumnName("Product Quantity");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jTable9.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable9MouseClicked(evt);
            }
        });
        jScrollPane9.setViewportView(jTable9);

        jSpinner2.setFont(new java.awt.Font("Tahoma", 1, 18));

        jSpinner2.setModel(new javax.swing.SpinnerNumberModel(0, 0, 99999, 1));

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton14)))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton14))
                .addContainerGap())
        );

        jTabbedPane3.addTab("Review Product Sum", jPanel5);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 643, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
        );

        jTabbedPane2.addTab("Inventory", jPanel3);

        jButton13.setText("Add User");
        jButton13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton13ActionPerformed(evt);
            }
        });

        jButton15.setText("Remove User");
        jButton15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton15ActionPerformed(evt);
            }
        });

        jTable8.getTableHeader().setReorderingAllowed(false);

        jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, userManagementList, jTable8, "");
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${userID}"));
        columnBinding.setColumnName("User ID");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${firstName}"));
        columnBinding.setColumnName("First Name");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${lastName}"));
        columnBinding.setColumnName("Last Name");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${username}"));
        columnBinding.setColumnName("Username");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${userType}"));
        columnBinding.setColumnName("User Type");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane8.setViewportView(jTable8);
        jTable8.validate();

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 603, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(30, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(93, 93, 93)
                .addComponent(jButton13, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
                .addGap(104, 104, 104)
                .addComponent(jButton15, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
                .addGap(137, 137, 137))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(30, 30, 30)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton13)
                    .addComponent(jButton15))
                .addGap(67, 67, 67))
        );

        jTabbedPane2.addTab("User Management", jPanel4);

        jTabbedPane4.setFont(new java.awt.Font("Tahoma", 1, 14));

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Name", "Type", "Supplier", "Price" }));
        jComboBox2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox2ActionPerformed(evt);
            }
        });

        jButton9.setText("Search");
        jButton9.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton9MouseClicked(evt);
            }
        });
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        jTextField2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextField2MouseClicked(evt);
            }
        });
        jTextField2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField2ActionPerformed(evt);
            }
        });

        jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, transactionProductsList1, jTable6);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${transProductID}"));
        columnBinding.setColumnName("Trans Product ID");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${transProductName}"));
        columnBinding.setColumnName("Trans Product Name");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${transProductPrice}"));
        columnBinding.setColumnName("Trans Product Price");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productQuantity}"));
        columnBinding.setColumnName("Product Quantity");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productTotal}"));
        columnBinding.setColumnName("Product Total");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane6.setViewportView(jTable6);

        jLabel2.setText("Search:");

        jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, inventoryProductsList6, jTable7);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productName}"));
        columnBinding.setColumnName("Product Name");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productType}"));
        columnBinding.setColumnName("Product Type");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productSupplier}"));
        columnBinding.setColumnName("Product Supplier");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productPrice}"));
        columnBinding.setColumnName("Product Price");
        columnBinding.setColumnClass(Float.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${productQuantity}"));
        columnBinding.setColumnName("Product Quantity");
        columnBinding.setColumnClass(Integer.class);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane7.setViewportView(jTable7);

        jLabel3.setText("Transaction Products:");

        jButton3.setText("\\/");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabel4.setText("Inventory Products");

        jButton4.setText("/\\");
            jButton4.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton4ActionPerformed(evt);
                }
            });

            jTextField3.setEditable(false);
            jTextField3.setText("0.00");
            jTextField3.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jTextField3ActionPerformed(evt);
                }
            });

            jLabel5.setText("Total Cost");

            jButton10.setText("Confirm");
            jButton10.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton10ActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGap(60, 60, 60)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(3, 3, 3)
                            .addComponent(jLabel3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton3)
                            .addGap(30, 30, 30)
                            .addComponent(jButton4)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jSpinner3, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addGap(36, 36, 36)
                                    .addComponent(jButton10))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addGap(26, 26, 26)
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
                                        .addComponent(jLabel5)))))
                        .addComponent(jLabel4)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jButton9)))
                    .addContainerGap())
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton9))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel4)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton4)
                        .addComponent(jButton3)
                        .addComponent(jSpinner3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel3))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel5)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                            .addComponent(jButton10)
                            .addGap(30, 30, 30))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap())))
            );

            jTabbedPane4.addTab("Add Transaction", jPanel1);

            jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, transactionListList, jTable1);
            columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${transactionID}"));
            columnBinding.setColumnName("Transaction ID");
            columnBinding.setColumnClass(Integer.class);
            columnBinding.setEditable(false);
            columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${transactionDate}"));
            columnBinding.setColumnName("Transaction Date");
            columnBinding.setColumnClass(java.util.Date.class);
            columnBinding.setEditable(false);
            columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${transactionCost}"));
            columnBinding.setColumnName("Transaction Cost");
            columnBinding.setColumnClass(Float.class);
            columnBinding.setEditable(false);
            bindingGroup.addBinding(jTableBinding);
            jTableBinding.bind();
            jScrollPane1.setViewportView(jTable1);

            jButton2.setText("View Transaction Details");
            jButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton2ActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
            jPanel2.setLayout(jPanel2Layout);
            jPanel2Layout.setHorizontalGroup(
                jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)
                            .addContainerGap())
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                            .addComponent(jButton2)
                            .addGap(258, 258, 258))))
            );
            jPanel2Layout.setVerticalGroup(
                jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jButton2)
                    .addGap(136, 136, 136))
            );

            jTabbedPane4.addTab("Transaction List", jPanel2);

            jTabbedPane2.addTab("Transaction", jTabbedPane4);

            jButton1.setFont(new java.awt.Font("Tahoma", 1, 18));
            jButton1.setText("Log-out");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(545, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addContainerGap())
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 648, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addContainerGap())
            );

            bindingGroup.bind();

            pack();
        }// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
       
        JOptionPane confirm = new JOptionPane();
        int opt = confirm.showConfirmDialog(this, "Are you sure you want to log out?", "Confirm", YES_NO_OPTION);
        if (opt == YES_OPTION){
                   this.setVisible(false);
        new Login().setVisible(true);
        }

    // TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed

private void jTabbedPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane2MouseClicked
try {
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
             Statement stmt = null;
            //SQL query command
            stmt = con.createStatement();
              
        for(int i=0;i<jTable3.getRowCount();i++)
        {    
        for(int j=0;j<jTable3.getColumnCount();j++)
            {
               jTable3.setValueAt("", i, j);
               }
        }
        
        ResultSet rs2 = null;
        String strsSQL2 = "SELECT * FROM inventory_products;";
        rs2 = stmt.executeQuery(strsSQL2);
        int q=-1;     
        
        while(rs2.next()){
        q++;
         jTable3.setValueAt(rs2.getInt("ProductID"), q, 0);
          jTable3.setValueAt(rs2.getString("ProductName"), q, 1);
          jTable3.setValueAt(rs2.getString("ProductType"), q, 2);
          jTable3.setValueAt(rs2.getString("ProductLabel"), q, 3);
          jTable3.setValueAt(rs2.getString("ProductSupplier"), q, 4);
          jTable3.setValueAt(rs2.getString("ProductPrice"), q, 5);
          jTable3.setValueAt(rs2.getString("ProductQuantity"), q, 6);}
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } catch (ArrayIndexOutOfBoundsException aE){
            javax.swing.JOptionPane.showMessageDialog(this, "Nothing is selected.");  
        } 
    // TODO add your handling code here:
   
}//GEN-LAST:event_jTabbedPane2MouseClicked

private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
 int zq=0;
    try {
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
             Statement stmt = null;
             int rs = 0;
            //SQL query command
            stmt = con.createStatement();
            
              
        for(int i=0;i<jTable6.getRowCount();i++)
        {    
        for(int j=0;j<jTable6.getColumnCount();j++)
            {
               jTable6.setValueAt(null, i, j);
               }
        }
        
         System.out.println("liit"); 
        /*ResultSet rs3=null, rs4 = null;
        int rs5 = 0;
             String strSQL3 = "SELECT * FROM transaction_products";
             rs3 = stmt.executeQuery(strSQL3);
        
        while(rs3.next()){        
             int decrease = rs3.getInt("ProductQuantity");
             String value = rs3.getString("TransProductName");
             
             rs4=null;     
             String strSQL5 = "SELECT * FROM inventory_products WHERE ProductName ='" + value + "';";
             rs4 = stmt.executeQuery(strSQL5);
             
             int current = rs3.getInt("ProductQuantity");
             while(rs3.next()){ 
                rs5 = 0;     
                String strSQL6 = "UPDATE inventory_products SET ProductQuantity="+ (current-decrease) +" WHERE ProductName = '"+ value +"';";
                rs5 = stmt.executeUpdate(strSQL6);
             }
             
          }
        */
             
        int rs2 = 0;
        String strsSQL2 = "TRUNCATE TABLE transaction_products;";
        rs2 = stmt.executeUpdate(strsSQL2);
        float totalcost = new Float(jTextField3.getText());
        int rs8 = 0;
        System.out.println(totalcost);
        String strSQL6 = "INSERT INTO transaction_list(TransactionDate, TransactionCost) VALUES (CURDATE(), "+ totalcost + ");";
        rs8 = stmt.executeUpdate(strSQL6);
              
         for(int i=0;i<jTable1.getRowCount();i++)
        {    
        for(int j=0;j<jTable1.getColumnCount();j++)
            {
               jTable1.setValueAt(null, i, j);
            }
        }
        
            ResultSet rs9 = null;
             String strSQL9 = "SELECT * FROM transaction_list;";
             rs9 = stmt.executeQuery(strSQL9);
       zq = 0;
        while(rs9.next()){
          jTable1.setValueAt(rs9.getInt("TransactionID"), zq, 0);
          jTable1.setValueAt(rs9.getDate("TransactionDate"), zq, 1);
          jTable1.setValueAt(rs9.getString("TransactionCost"), zq, 2);
          zq++;
          }
        
        
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } 
    // TODO add your handling code here:
}//GEN-LAST:event_jButton10ActionPerformed

private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed
    
    
    // TODO add your handling code here:
}//GEN-LAST:event_jTextField3ActionPerformed

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
 try {
                       
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
             Statement stmt = null;
             ResultSet rs = null;
            stmt = con.createStatement();
            
           int spin2 = Integer.parseInt(jSpinner3.getValue().toString());  
           int row = jTable6.getSelectedRow();
            Object value = jTable6.getValueAt(row, 1);
            String strsSQL = "SELECT * FROM transaction_products WHERE TransProductName = '" + value.toString() + "';";
            String deleteRow = ""; 
            int q=-1;
            rs = stmt.executeQuery(strsSQL);
            int rs2 = 0;
          while(rs.next()){
          q++;
          if(rs.getInt("ProductQuantity")==spin2)
          {
          deleteRow = "DELETE FROM transaction_products WHERE TransProductName = '" + value.toString() +"';";
          
             
          }
          if(rs.getInt("ProductQuantity")>spin2)
          {
          deleteRow = "UPDATE transaction_products SET ProductQuantity = " + (rs.getInt("ProductQuantity")-spin2) + " WHERE TransProductName = '" + value.toString() + "';";   
          }
        }
          rs2 = stmt.executeUpdate(deleteRow);
          
               
        for(int i=0;i<jTable6.getRowCount();i++)
        {    
        for(int j=0;j<jTable6.getColumnCount();j++)
            {
               jTable6.setValueAt(null, i, j);
               }
        }
        
        
        ResultSet rs3 = null;
        String strsSQL5 = "SELECT * FROM transaction_products;";
        rs3 = stmt.executeQuery(strsSQL5);
        int b=-1;     
        while(rs3.next()){
        b++;
          jTable6.setValueAt(rs3.getInt("TransProductID"), b, 0);
          jTable6.setValueAt(rs3.getString("TransProductName"), b, 1);
          jTable6.setValueAt(rs3.getFloat("TransProductPrice"), b, 2);
          jTable6.setValueAt(rs3.getInt("ProductQuantity"), b, 3);
          jTable6.setValueAt(rs3.getFloat("ProductTotal"), b, 4);
        }
        
         ResultSet rs10 = null;
        int zx=-1;
        String strsSQL7 = "SELECT * FROM transaction_products;";
        rs10 = stmt.executeQuery(strsSQL7);
        float totalcosts=0;  
        
        while(rs10.next()){        
          zx++;
          totalcosts = totalcosts + rs10.getFloat("ProductTotal");
          } 
        jTextField3.setText(Float.toString(totalcosts));
        
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } catch (ArrayIndexOutOfBoundsException aE){
            System.out.println("Nothing is selected.");
        }
         
    
    // TODO add your handling code here:
}//GEN-LAST:event_jButton4ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
 
    try {
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
             Statement stmt = null;
                
            
            stmt = con.createStatement();
            ResultSet rs2 = null;
            int tproductID=0;
            String tProductName="";
            float tProductPrice=0;
            int row = jTable7.getSelectedRow();
            Object value = jTable7.getValueAt(row, 0);
            System.out.println(value.toString());
            String strsSQL = "SELECT * FROM inventory_products WHERE ProductName = '" + value.toString() + "';";
            
             rs2 = stmt.executeQuery(strsSQL);
        while(rs2.next()){     
        tproductID = rs2.getInt("ProductID");
        tProductName = rs2.getString("ProductName");
        tProductPrice = rs2.getFloat("ProductPrice");
        }
        
        int spin = Integer.parseInt(jSpinner1.getValue().toString()); 
        float price = tProductPrice;
        
        int rs=0;     
             String strSQL = "INSERT INTO transaction_products (TransProductID, TransProductName, TransProductPrice, ProductQuantity, ProductTotal)" +
                            " VALUES ( " + tproductID + ", '" + tProductName + "', " + 
                            price + "," + spin + "," + (price*spin) + ");";
             
        rs = stmt.executeUpdate(strSQL);
            
         for(int i=0;i<jTable6.getRowCount();i++)
        {    
        for(int j=0;j<jTable6.getColumnCount();j++)
            {
               jTable6.setValueAt(null, i, j);
            }
        }
         
        ResultSet rs3 = null;
        int z=-1;
        String strsSQL2 = "SELECT * FROM transaction_products;";
        rs3 = stmt.executeQuery(strsSQL2);
           
        
        while(rs3.next()){        
          z++;
          jTable6.setValueAt(rs3.getInt("TransProductID"), z, 0);
          jTable6.setValueAt(rs3.getString("TransProductName"), z, 1);
          jTable6.setValueAt(rs3.getFloat("TransProductPrice"), z, 2);
          jTable6.setValueAt(rs3.getInt("ProductQuantity"), z, 3);
          jTable6.setValueAt(rs3.getFloat("ProductTotal"), z, 4);         
          }
        ResultSet rs4 = null;
        int zx=-1;
        String strsSQL7 = "SELECT * FROM transaction_products;";
        rs4 = stmt.executeQuery(strsSQL7);
        float totalcosts=0;  
        
        while(rs4.next()){        
          zx++;
          totalcosts = totalcosts + rs4.getFloat("ProductTotal");
          } 
        jTextField3.setText(Float.toString(totalcosts));
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } 

           // TODO add your handling code here:
}//GEN-LAST:event_jButton3ActionPerformed

private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed

// TODO add your handling code here:
}//GEN-LAST:event_jTextField2ActionPerformed

private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_jButton9ActionPerformed

private void jButton9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton9MouseClicked
String searched = jTextField2.getText(); 
    
    try {
            
        for(int i=0;i<jTable7.getRowCount();i++)
        {    
        for(int j=0;j<jTable7.getColumnCount();j++)
            {
               jTable7.setValueAt(null, i, j);
            }
        }
        
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
             Statement stmt = null;
             ResultSet rs = null;
            //SQL query command
            stmt = con.createStatement();
            String strsSQL = "";
            if(jComboBox2.getSelectedItem().toString().equals("Name")) 
            strsSQL = "SELECT * FROM inventory_products WHERE ProductName LIKE '%" + searched + "%';";
            else if(jComboBox2.getSelectedItem().toString().equals("Type"))
            strsSQL = "SELECT * FROM inventory_products WHERE ProductType LIKE '%" + searched + "%';";
            else if(jComboBox2.getSelectedItem().toString().equals("Supplier"))
            strsSQL = "SELECT * FROM inventory_products WHERE ProductSupplier LIKE '%" + searched + "%';";
           
             
               
        
        rs = stmt.executeQuery(strsSQL);
        int q=-1;     
        
        while(rs.next()){
        q++;
          jTable7.setValueAt(rs.getString("ProductName"), q, 0);
          jTable7.setValueAt(rs.getString("ProductType"), q, 1);
          jTable7.setValueAt(rs.getString("ProductSupplier"), q, 2);
          jTable7.setValueAt(rs.getString("ProductPrice"), q, 3);
        }
        
        
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        }     // TODO add your handling code here:
}//GEN-LAST:event_jButton9MouseClicked

private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBox2ActionPerformed

private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
        JOptionPane confirm = new JOptionPane();
        
        int opt = confirm.showConfirmDialog(this, "Are you sure you want to remove this user?", "Confirm", YES_NO_OPTION);
        
        if (opt == YES_OPTION){
                   try {
                       
            
                       
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
            int row = jTable8.getSelectedRow();
            Object value = jTable8.getValueAt(row, 3);
             Statement stmt = null;
             int rs = 0;
            //SQL query command
            stmt = con.createStatement();
             String strsSQL = "DELETE FROM user_management WHERE username = '" + value.toString() + "';";
             
             rs = stmt.executeUpdate(strsSQL);
               
        
        for(int i=0;i<jTable8.getRowCount();i++)
        {    
        for(int j=0;j<jTable8.getColumnCount();j++)
            {
               jTable8.setValueAt(null, i, j);
               }
        }
        
        ResultSet rs2 = null;
        String strsSQL2 = "SELECT * FROM user_management;";
        rs2 = stmt.executeQuery(strsSQL2);
        int q=-1;     
        
        while(rs2.next()){
        q++;
          jTable8.setValueAt(rs2.getInt("UserID"), q, 0);
          jTable8.setValueAt(rs2.getString("firstName"), q, 1);
          jTable8.setValueAt(rs2.getString("lastName"), q, 2);
          jTable8.setValueAt(rs2.getString("username"), q, 3);
          jTable8.setValueAt(rs2.getString("userType"), q, 4);
            
        
        }
        
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } catch (ArrayIndexOutOfBoundsException aE){
            javax.swing.JOptionPane.showMessageDialog(this, "Nothing is selected.");  
        } 
        } 
        
        
    // TODO add your handling code here:
}//GEN-LAST:event_jButton15ActionPerformed

private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
    new AddUser().setVisible(true);
    this.setVisible(false);
    
    // TODO add your handling code here:
}//GEN-LAST:event_jButton13ActionPerformed

private void jTabbedPane3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane3MouseClicked
try {
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
             Statement stmt = null;
            //SQL query command
            stmt = con.createStatement();
              
        for(int i=0;i<jTable3.getRowCount();i++)
        {    
        for(int j=0;j<jTable3.getColumnCount();j++)
            {
               jTable3.setValueAt("", i, j);
               }
        }
        
        ResultSet rs2 = null;
        String strsSQL2 = "SELECT * FROM inventory_products;";
        rs2 = stmt.executeQuery(strsSQL2);
        int q=-1;     
        
        while(rs2.next()){
        q++;
         jTable3.setValueAt(rs2.getInt("ProductID"), q, 0);
          jTable3.setValueAt(rs2.getString("ProductName"), q, 1);
          jTable3.setValueAt(rs2.getString("ProductType"), q, 2);
          jTable3.setValueAt(rs2.getString("ProductLabel"), q, 3);
          jTable3.setValueAt(rs2.getString("ProductSupplier"), q, 4);
          jTable3.setValueAt(rs2.getString("ProductPrice"), q, 5);
          jTable3.setValueAt(rs2.getString("ProductQuantity"), q, 6);}
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } catch (ArrayIndexOutOfBoundsException aE){
            javax.swing.JOptionPane.showMessageDialog(this, "Nothing is selected.");  
        } 
    // TODO add your handling code here:
    // TODO add your handling code here:
}//GEN-LAST:event_jTabbedPane3MouseClicked

private void jTable9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable9MouseClicked

}//GEN-LAST:event_jTable9MouseClicked

private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
        
    
    // TODO add your handling code here:
}//GEN-LAST:event_jButton14ActionPerformed

private void jButton14MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton14MouseClicked
int sp = Integer.parseInt(jSpinner2.getValue().toString()); 
if (sp==0)
    
            javax.swing.JOptionPane.showMessageDialog(this, "Please input a valid quantity."); 
else{
         try {
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
            int row = jTable9.getSelectedRow();
            Object value = jTable9.getValueAt(row, 0);
             Statement stmt = null;
             int rs = 0;
            //SQL query command
            stmt = con.createStatement();
             String strsSQL = "UPDATE inventory_products SET ProductQuantity="+sp+" WHERE ProductID = " + value.toString() + ";";
             rs = stmt.executeUpdate(strsSQL);
             
              
        for(int i=0;i<jTable9.getRowCount();i++)
        {    
        for(int j=0;j<jTable9.getColumnCount();j++)
            {
               jTable9.setValueAt("", i, j);
               }
        }
        
        ResultSet rs2 = null;
        String strsSQL2 = "SELECT * FROM inventory_products;";
        rs2 = stmt.executeQuery(strsSQL2);
        int q=-1;     
        
        while(rs2.next()){
        q++;
          jTable9.setValueAt(rs2.getInt("ProductID"), q, 0);
          jTable9.setValueAt(rs2.getString("ProductName"), q, 1);
          jTable9.setValueAt(rs2.getString("ProductPrice"), q, 2);
          jTable9.setValueAt(rs2.getInt("ProductQuantity"), q, 3);
        }
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } catch (ArrayIndexOutOfBoundsException aE){
            javax.swing.JOptionPane.showMessageDialog(this, "Nothing is selected.");  
        } 
}
         // TODO add your handling code here:
}//GEN-LAST:event_jButton14MouseClicked

private void jTable4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable4MouseClicked
    // TODO add your handling code here:
}//GEN-LAST:event_jTable4MouseClicked

private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBox1ActionPerformed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed

    // TODO add your handling code here:
}//GEN-LAST:event_jButton5ActionPerformed

private void jButton5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MouseClicked
String searched = jTextField1.getText(); 
    
    try {
            
        for(int i=0;i<jTable4.getRowCount();i++)
        {    
        for(int j=0;j<jTable4.getColumnCount();j++)
            {
               jTable4.setValueAt(null, i, j);
            }
        }
        
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
             Statement stmt = null;
             ResultSet rs = null;
            //SQL query command
            stmt = con.createStatement();
            String strsSQL = "";
            if(jComboBox1.getSelectedItem().toString().equals("Name")) 
            strsSQL = "SELECT * FROM inventory_products WHERE ProductName LIKE '%" + searched + "%';";
            else if(jComboBox1.getSelectedItem().toString().equals("Type"))
            strsSQL = "SELECT * FROM inventory_products WHERE ProductType LIKE '%" + searched + "%';";
            else if(jComboBox1.getSelectedItem().toString().equals("Supplier"))
            strsSQL = "SELECT * FROM inventory_products WHERE ProductSupplier LIKE '%" + searched + "%';";
           
             
               
        
        rs = stmt.executeQuery(strsSQL);
        int q=-1;     
        
        while(rs.next()){
        q++;
          jTable4.setValueAt(rs.getInt("ProductID"), q, 0);
          jTable4.setValueAt(rs.getString("ProductName"), q, 1);
          jTable4.setValueAt(rs.getString("ProductType"), q, 2);
          jTable4.setValueAt(rs.getString("ProductLabel"), q, 3);
          jTable4.setValueAt(rs.getString("ProductSupplier"), q, 4);
          jTable4.setValueAt(rs.getString("ProductPrice"), q, 5);
          jTable4.setValueAt(rs.getInt("ProductQuantity"), q, 6);
        }
        
        
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } 
                   
        // TODO add your handling code here:
}//GEN-LAST:event_jButton5MouseClicked

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
    
    // TODO add your handling code here:
}//GEN-LAST:event_jTextField1ActionPerformed

private void jTextField1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField1MouseClicked
jTextField1.setText("");
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1MouseClicked

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
    new AddProduct().setVisible(true);
    this.hide();
    // TODO add your handling code here:
}//GEN-LAST:event_jButton6ActionPerformed

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
    try {
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
            int row = jTable3.getSelectedRow();
            Object value = jTable3.getValueAt(row, 1);
             Statement stmt = null;
             ResultSet rs = null;
            //SQL query command
            stmt = con.createStatement();
            String strsSQL = "";
            strsSQL = "SELECT * FROM inventory_products WHERE ProductName = '" + value.toString() + "';";
            
             rs = stmt.executeQuery(strsSQL);
             
             while (rs.next())
      {
        ProductID1 = rs.getInt("ProductID");
        ProductName1 = rs.getString("ProductName");
        ProductType1 = rs.getString("ProductType");
        ProductPrice1 = rs.getFloat("ProductPrice");
        ProductSupplier1 = rs.getString("ProductSupplier");
        ProductLabel1 = rs.getString("ProductLabel"); 
      }

    new EditProduct().setVisible(true);
    this.hide();
    } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        }  catch (ArrayIndexOutOfBoundsException aE){
            javax.swing.JOptionPane.showMessageDialog(this, "Nothing is selected.");  
        }      
    // TODO add your handling code here:
    
    
       
}//GEN-LAST:event_jButton8ActionPerformed

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed

        
        JOptionPane confirm = new JOptionPane();
        int opt = confirm.showConfirmDialog(this, "Are you sure you want to remove this product?", "Confirm", YES_NO_OPTION);
        if (opt == YES_OPTION){
            try {
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
            int row = jTable3.getSelectedRow();
            Object value = jTable3.getValueAt(row, 1);
             Statement stmt = null;
             int rs = 0;
            //SQL query command
            stmt = con.createStatement();
             String strsSQL = "DELETE FROM inventory_products WHERE ProductName = '" + value.toString() + "';";
             rs = stmt.executeUpdate(strsSQL);
             
                
        
        for(int i=0;i<jTable3.getRowCount();i++)
        {    
        for(int j=0;j<jTable3.getColumnCount();j++)
            {
               jTable3.setValueAt(null, i, j);
               }
        }
        
        ResultSet rs2 = null;
        String strsSQL2 = "SELECT * FROM inventory_products;";
        rs2 = stmt.executeQuery(strsSQL2);
        int q=-1;     
        
        while(rs2.next()){
        q++;
          jTable3.setValueAt(rs2.getInt("ProductID"), q, 0);
          jTable3.setValueAt(rs2.getString("ProductName"), q, 1);
          jTable3.setValueAt(rs2.getString("ProductType"), q, 2);
          jTable3.setValueAt(rs2.getString("ProductLabel"), q, 3);
          jTable3.setValueAt(rs2.getString("ProductSupplier"), q, 4);
          jTable3.setValueAt(rs2.getString("ProductPrice"), q, 5);
            
        
        }
        
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } catch (ArrayIndexOutOfBoundsException aE){
            javax.swing.JOptionPane.showMessageDialog(this, "Nothing is selected.");  
        } 
        }
    // TODO add your handling code here:
}//GEN-LAST:event_jButton7ActionPerformed

private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton17ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton17ActionPerformed

private void jButton17MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton17MouseClicked
int sp = Integer.parseInt(jSpinner4.getValue().toString());  
         try {
            Class.forName("com.mysql.jdbc.Driver");
            String connectionUrl = "jdbc:mysql://localhost/starter?" +
                                   "user=root&password=password";
            Connection con = DriverManager.getConnection(connectionUrl);
            
            int row = jTable4.getSelectedRow();
            Object value = jTable4.getValueAt(row, 0);
             Statement stmt = null;
             int rs = 0;
            //SQL query command
            stmt = con.createStatement();
             String strsSQL = "UPDATE inventory_products SET ProductQuantity="+sp+" WHERE ProductID = " + value.toString() + ";";
             rs = stmt.executeUpdate(strsSQL);
             
              
        for(int i=0;i<jTable4.getRowCount();i++)
        {    
        for(int j=0;j<jTable4.getColumnCount();j++)
            {
               jTable4.setValueAt("", i, j);
               }
        }
        
        ResultSet rs2 = null;
        String strsSQL2 = "SELECT * FROM inventory_products;";
        rs2 = stmt.executeQuery(strsSQL2);
        int q=-1;     
        
        while(rs2.next()){
        q++;
          jTable4.setValueAt(rs2.getInt("ProductID"), q, 0);
          jTable4.setValueAt(rs2.getString("ProductName"), q, 1);
          jTable4.setValueAt(rs2.getString("ProductType"), q, 2);
          jTable4.setValueAt(rs2.getString("ProductLabel"), q, 3);
          jTable4.setValueAt(rs2.getString("ProductSupplier"), q, 4);
          jTable4.setValueAt(rs2.getString("ProductPrice"), q, 5);
          jTable4.setValueAt(rs2.getInt("ProductQuantity"), q, 6);
        }
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        } catch (ArrayIndexOutOfBoundsException aE){
            javax.swing.JOptionPane.showMessageDialog(this, "Nothing is selected.");  
        }
    // TODO add your handling code here:
}//GEN-LAST:event_jButton17MouseClicked

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed

private void jTextField2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField2MouseClicked
jTextField2.setText("");// TODO add your handling code here:
}//GEN-LAST:event_jTextField2MouseClicked

    /**
     * @param args the command line arguments
     */
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private java.util.List<javaapplication1.InventoryProducts> inventoryProductsList;
    private java.util.List<javaapplication1.InventoryProducts> inventoryProductsList1;
    private java.util.List<javaapplication1.InventoryProducts> inventoryProductsList2;
    private java.util.List<javaapplication1.InventoryProducts> inventoryProductsList3;
    private java.util.List<javaapplication1.InventoryProducts> inventoryProductsList4;
    private java.util.List<javaapplication1.InventoryProducts> inventoryProductsList5;
    private java.util.List<javaapplication1.InventoryProducts> inventoryProductsList6;
    private javax.persistence.Query inventoryProductsQuery;
    private javax.persistence.Query inventoryProductsQuery1;
    private javax.persistence.Query inventoryProductsQuery2;
    private javax.persistence.Query inventoryProductsQuery3;
    private javax.persistence.Query inventoryProductsQuery4;
    private javax.persistence.Query inventoryProductsQuery5;
    private javax.persistence.Query inventoryProductsQuery6;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton15;
    private javax.swing.JButton jButton17;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JSpinner jSpinner1;
    private javax.swing.JSpinner jSpinner2;
    private javax.swing.JSpinner jSpinner3;
    private javax.swing.JSpinner jSpinner4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTabbedPane jTabbedPane3;
    private javax.swing.JTabbedPane jTabbedPane4;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable3;
    private javax.swing.JTable jTable4;
    private javax.swing.JTable jTable6;
    private javax.swing.JTable jTable7;
    private javax.swing.JTable jTable8;
    private javax.swing.JTable jTable9;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.persistence.EntityManager starterPUEntityManager;
    private java.util.List<javaapplication1.TransactionList> transactionListList;
    private javax.persistence.Query transactionListQuery;
    private java.util.List<javaapplication1.TransactionProducts> transactionProductsList;
    private java.util.List<javaapplication1.TransactionProducts> transactionProductsList1;
    private javax.persistence.Query transactionProductsQuery;
    private javax.persistence.Query transactionProductsQuery1;
    private java.util.List<javaapplication1.UserManagement> userManagementList;
    private javax.persistence.Query userManagementQuery;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

    public void persist(Object object) {
        starterPUEntityManager.getTransaction().begin();
        try {
            starterPUEntityManager.persist(object);
            starterPUEntityManager.getTransaction().commit();
        } catch (Exception e) {
            e.printStackTrace();
            starterPUEntityManager.getTransaction().rollback();
        } finally {
            starterPUEntityManager.close();
        }
    }
    
     
}

